package com.hspedu.homework.homework06;


/**
 * @Author Stringzhua
 * @Date 2024/3/7 15:30
 * description:创建交通工具工厂类,有两个方法分别获得交通工具Horse和Boat
 */
public class VehiclesFactory {
    //这里将方法做成static,比较方便
    //认为马儿始终是同一匹
    private static Horse horse=new Horse();//恶汉式
    private VehiclesFactory(){}//构造器私有化
    public static Horse getHorse(){
//        return new Horse();
        return horse;
    }
    public static Boat getBoat(){
        return new Boat();
    }
    public static Plane getPlane(){
        return new Plane();
    }
}
